

local mt = ac.skill['寒冰碎片']
mt.targettype = '点'
mt.range = 900
mt.distance = 1200
mt.missile_art = [[war3mapImported\IceBolt.mdl]]
mt.missile_height = 125
mt.missile_speed = 900
mt.missile_size = 2
mt.model1 = [[Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl]]
mt.targetArt1 = [[war3mapImported\ChainFreeze_F6.mdx]]
mt.targetArt2 = [[Abilities\Weapons\FrostWyrmMissile\FrostWyrmMissile.mdl]]

function mt:on_cast_shot()
    local hero = self.owner
    local point = self.target:get_point()
    local damage = hero:get('攻击') * self.data1 / 100
    local mover = hero:launch_wave(self.missile_art,hero:get_point()/point,900,1200,2,125)
    local track = hero:track_select(mover,150,mover.distance/mover.speed,function(u)
        u:add_effect(self.targetArt1,'chest'):remove()
        u:add_effect(self.targetArt2,'chest'):remove()
        hero:create_damage(u,damage,self)
    end)

    mover.on_finish = function(mvr)

        local point = mvr:get_point()
        local angle = mvr.angle
        local num = 5
        hero:aoe_damage(point,300,damage,self,function(u)
            return track:has(u)
        end)
        for a=1,num do
            local point = point - {angle + (a-num/2-0.5)*40,200}
            point:effect{
                model = self.model1,
                time = 2,
                size = 0.8,
            }
        end
    end
end






local mt = ac.skill['海象神拳']
mt.temp = '攻击触发'
mt.casterArt = [[war3mapImported\WalrusPunchWeaponFX.mdx]]
mt.targetArt1 = [[Abilities\Spells\Other\FrostBolt\FrostBoltMissile.mdl]]
mt.targetArt2 = [[Abilities\Spells\Undead\FreezingBreath\FreezingBreathMissile.mdl]]

function mt:on_cooldown()
    if self.effect1 then self.effect1:remove() end
    self.effect1 = self.owner:add_effect(self.casterArt,'weapon')
end

function mt:on_run(hero,target)
    local hero = self.owner
    local damage = hero:get('攻击') * self.data1/100
    if self.effect1 then self.effect1:remove() end
    ac.texttag{
        text = '|cffff0000海象神拳！|r',
        target = target:get_point(),
        speed = 50,
        angle = 90,
        life = 2,
        jump_rate = 3,
        jump_time = 0.5,
        fade = 0,
        scale = 2,
    }
    -- ac.ui_tag {
    --     string = '|cffff0000海象神拳！|r',
    --     speed = 50,
    --     angle = 90,
    --     life = 2,
    --     fade = 0,
    --     scale = 2,
    --     position = target:get_point(),
    -- }
    target:add_effect(self.targetArt1,'overhead'):remove()
    target:add_effect(self.targetArt1,'head'):remove()
    target:add_effect(self.targetArt1,'left hand'):remove()
    target:add_effect(self.targetArt1,'right hand'):remove()
    target:add_effect(self.targetArt1,'chest'):remove()
    target:add_effect(self.targetArt1,'origin'):remove()
    target:add_effect(self.targetArt2,'chest',0.5)
    target:add_buff '击飞'{time = 1.5}
    target:add_buff '晕眩'{time = 2}
    target:damage{
        source = hero,
        damage = damage,
        skill = self.skill,
    }
end

